﻿<div ms-controller="LCSPLIST">
    <!-- 添加按钮 -->
    <div class="btn-add">
        <button type="button" class="btn btn-info btn-lg" ms-click="addLCSP()"><i class="iconfont icon-jiahao ft12 mr5"></i>添加工作流程</button>
    </div>
    <!-- 按条件选择 -->
    <div class="tab-filter-type">
        <div class="oh">
            <h5 class="pull-left tr">事项类型：</h5>
            <ul class="tab-type ft14">
                <!--<li><span class="active" ms-click="SelectType('0')">全部</span></li>-->
                <li ms-click="SelectType('1')"><span class="active">我创建的</span></li>
                <li ms-click="SelectType('2')"><span>待我审核的</span></li>
                <li ms-click="SelectType('3')"><span>我已审核的</span></li>
                <li ms-click="SelectType('4')"><span>抄送我的</span></li>
            </ul>
        </div>
        <div class="oh">
            <h5 class="pull-left tr">流程类别：</h5>
            <ul class="tab-type ft14" style="height: 40px;">
                <li ms-click="SelectLBType('')"><span class="active">全部</span></li>
                <li ms-repeat-el="LBTypeData" ms-click="SelectLBType(el.RelatedTable)"><span>{{el.RelatedTable}}</span></li>
            </ul>
        </div>
        <div class="oh">
            <h5 class="pull-left tr">流程名称：</h5>
            <ul class="tab-type ft14">
                <li ms-click="SelectXJType('')"><span class="active">全部</span></li>
                <li ms-repeat-el="TypeData" ms-click="SelectXJType(el.ID)"><span>{{el.ProcessName}}</span></li>
            </ul>
        </div>

        <!-- 搜索 -->
        <div class="oh">
            <div class="input-group ml15" style="width: 395px;">
                <input type="search" class="form-control" ms-duplex="search.searchcontent" placeholder="搜索流程名称,或者流程关键字查询">
                <span class="input-group-addon" ms-click="GetLIST()">搜索</span>
            </div>
        </div>
    </div>
    <!-- 展开更多选项 -->
    <div class="add-tab ft14 tc mt20" style="display: none;">
        <span>更多筛选<i class="caret"></i></span>
    </div>
    <!-- 表格 -->
    <div class="default-tab ft14 pt20">
        <table class="table table-striped table-responsive table-hover">
            <thead>
                <tr>
                    <th class="tc">
                        <!--<div class="icheckbox_square-blue">
                            <input type="checkbox">
                            <span class="iconfont icon-check ft12"></span>
                        </div>-->
                        序号
                    </th>
                    <th ms-repeat-im="ShowColumns" ms-visible="im.IsSel">{{im.ColText}}</th>
                </tr>
            </thead>
            <tbody>
                <tr ms-repeat-el="ListData">
                    <td class="tc">
                        <!--<div class="icheckbox_square-blue">
                            <input type="checkbox">
                            <span class="iconfont icon-check ft12"></span>
                        </div>-->
                        {{$index+1+page.pagecount*(page.pageindex-1)}}
                    </td>
                    <td ms-repeat-im="ShowColumns" ms-visible="im.IsSel" ms-class-1="lk:im.type=='link'" ms-click="ViewFormNew('LCSP_LCSP',el.ID,el.intProcessStanceid,$event)">{{ComFunJS.FnFormat(el[im.ColName],im)|html}}</td>
                    <td>
                        <a class="cz-btn ft18 js-color tip" data-toggle="tooltip" title="审批" ms-click="EditForm('LCSP_LCSP',el.ID,el.intProcessStanceid,$event)" ms-if="el.StateName!='-1'&&search.seartype==2">
                            <i class="iconfont icon-shenhe"></i>
                        </a>
                    </td>
                </tr>

            </tbody>
            <tfoot>
                <tr ms-if="isnull">
                    <td class="tc"></td>
                    <td>暂无数据</td>
                </tr>
            </tfoot>
        </table>
        <div class="ui-datatable-page ft14 pl20">

            <div id="pageDiv" ms-visible="model.page.total>model.pageNum[0].num" class="pull-right"></div>
            <div class="pull-right" ms-visible="ListData.size()!=0">
                <span>共{{model.page.total}}条记录</span>
                <span ms-visible="model.page.total>model.pageNum[0].num">选择每页条数
                    <select style="height: 25px; width: 50px;" ms-change="selNum(this.value)" ms-duplex="model.page.pagecount">
                        <option ms-repeat-pg="pageNum" ms-attr-value="pg.num" ms-attr-selected="pg.num==model.page.pagecount?'selected':''">{{pg.num}}</option>
                    </select>
                </span>
            </div>

        </div>
    </div>


</div>

<script>

    var tempindex = avalon.define({
        $id: "LCSPLIST",
        curXJType: "",
        curLBType: "",
        LBTypeData: [],
        SelectType: function (type) {
            model.search.seartype = type;
            tempindex.GetLIST();
        },
        SelectXJType: function (type) {
            tempindex.curXJType = type;
            tempindex.GetLIST();
        },
        SelectLBType: function (type) {
            tempindex.curLBType = type;
            tempindex.GetLIST();
        },
        selNum: function (item) {    //选择显示的条数
            model.page.pagecount = item;
            tempindex.GetLIST();
        },
        InitWigetData: function () {

            //显示的列名
            model.ShowColumns.clear();
            model.ShowColumns.pushArray([
                { "ColName": "RelatedTable", "ColText": "流程类别", "IsSel": true, "format": "text" },
                { "ColName": "ProcessName", "ColText": "流程名称", "IsSel": true, "format": "text", "type": "link" },
                { "ColName": "ShenQingRen", "ColText": "申请人", "IsSel": true, "format": "text" },
                { "ColName": "CRDate", "ColText": "申请时间", "IsSel": true, "format": "dateformat" },
                { "ColName": "StateName", "ColText": "状态", "IsSel": true, "format": "statename" }
            ]);
            //类型数据
            $.getJSON('/API/VIEWAPI.ashx?Action=LCSP_GETLCBDLB', {}, function (resultData) {
                if (resultData.ErrorMsg == "" && resultData.Result.length > 0) {
                    tempindex.LBTypeData = resultData.Result;
                }
            })
            tempindex.GetLCSP();
            tempindex.GetLIST();
        },
        addLCSP: function () {
            top.ComFunJS.winviewform("/ViewV5/AppPage/LCSP/APP_LCSP_SEL.html?r=" + Math.random(), "流程表单", "1000", "");
        },
        GetLCSP: function () {
            $.getJSON('/API/VIEWAPI.ashx?Action=LCSP_GETWFPDLIST', { P1: 1 }, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    model.TypeData = resultData.Result;
                }
            })
        },
        GetLIST: function () {
            model.page.pageindex = 1;
            model.ListData.clear();
            $.getJSON('/API/VIEWAPI.ashx?Action=LCSP_GETLCSPLIST', { p: 1, P1: model.search.seartype, pagecount: model.page.pagecount, Content: model.search.searchcontent, lb: tempindex.curXJType, lb1: tempindex.curLBType }, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    model.ListData = resultData.Result;
                    if (model.ListData.size() == 0) { model.isnull = true; } else { model.isnull = false; }
                    model.page.total = resultData.Result1;
                    laypage({
                        cont: 'pageDiv', //容器。值支持id名、原生dom对象，jquery对象。
                        pages: Math.ceil(parseInt(resultData.Result1) * 1.0 / model.page.pagecount), //通过后台拿到的总页数
                        curr: 1, //初始化当前页
                        skin: 'molv',
                        jump: function (e) { //触发分页后的回调
                            if (e.curr != model.page.pageindex) {
                                $.getJSON('/API/VIEWAPI.ashx?Action=LCSP_GETLCSPLIST', { p: e.curr, P1: model.search.seartype, pagecount: model.page.pagecount, Content: model.search.searchcontent, lb: tempindex.curXJType }, function (resultData) {
                                    if (resultData.ErrorMsg == "") {
                                        model.ListData = resultData.Result;
                                    }
                                })
                                model.page.pageindex = e.curr;
                            }
                        }
                    });
                }
            })
        }
    })
    //# sourceURL=LCSPLIST.js;
</script>
